function [ mpc ] = carMPCNON2(sys, x, u, k, param )
ref=param.ref(:,k:k+param.Tp-1);
pomoc=ref(:,1);
ref=kron(pomoc(:),ones(1,param.Tp));
[m,n]=size(ref);
refCol=ref(1:m*n);
refCol=refCol.';
refT=zeros(m,n);
refT(1:m*n)=refCol(1:m*n);
refT=refT.';
mpc=InitMPC(sys,diag(param.diagQ),diag(param.diagR),diag(param.diagH));
mpc=MPCSampling(mpc,param.Tp,param.Tvz,blockMatrix(sys,param.Tvz,param.Block));
mpc=MPCHardBounds(mpc,createBounds(3,param.Tvz,param.lb,param.boundLocation,-1),createBounds(3,param.Tvz,param.ub,param.boundLocation,1));
mpc=MPCSoftBounds(mpc,createBounds(6,param.Tp,param.lb_w,[],-1),createBounds(6,param.Tp,param.ub_w,[],1),selectSoftBounds(length(sys.A),param.Tp,param.kroky,param.promenne));
mpc=addMPCstate(mpc,x);
mpc=addMPCcontrol(mpc,u);
mpc=addMPCref(mpc,refCol);
mpc.model=@carFceSol;
mpc.param=param;
end